'''

Copyright 2019, Amazon Web Services Inc.

SPDX-License-Identifier: MIT-0

Defines a MetricDescription collection. Provides a single function that returns
a list of all currently-working (April 2019) metric/agg/dimension combinations.
Ideally, Open Distro would provide an API to retrieve this information. As of
now, it has to be declarative like this.
'''

from collections import namedtuple

MetricDescription = namedtuple('MetricDescription', ['name', 'agg', 'dimensions'])

def get_working_metric_descriptions():
    ''' Return a list of all of the metric descriptions for PA.'''
    return [
        MetricDescription(name='CPU_Utilization', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='CPU_Utilization', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='CPU_Utilization', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='CPU_Utilization', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Paging_MajfltRate', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Paging_MajfltRate', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Paging_MajfltRate', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Paging_MajfltRate', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Paging_MinfltRate', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Paging_MinfltRate', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Paging_MinfltRate', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Paging_MinfltRate', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Paging_RSS', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Paging_RSS', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Paging_RSS', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Paging_RSS', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Sched_Runtime', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Sched_Runtime', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Sched_Runtime', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Sched_Runtime', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Sched_Waittime', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Sched_Waittime', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Sched_Waittime', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Sched_Waittime', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Sched_CtxRate', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Sched_CtxRate', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Sched_CtxRate', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Sched_CtxRate', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Heap_AllocRate', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Heap_AllocRate', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Heap_AllocRate', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Heap_AllocRate', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_ReadThroughput', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_ReadThroughput', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_ReadThroughput', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_ReadThroughput', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_WriteThroughput', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_WriteThroughput', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_WriteThroughput', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_WriteThroughput', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_TotThroughput', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_TotThroughput', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_TotThroughput', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_TotThroughput', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_ReadSyscallRate', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_ReadSyscallRate', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_ReadSyscallRate', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_ReadSyscallRate', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_WriteSyscallRate', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_WriteSyscallRate', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_WriteSyscallRate', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_WriteSyscallRate', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_TotalSyscallRate', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_TotalSyscallRate', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_TotalSyscallRate', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='IO_TotalSyscallRate', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Thread_Blocked_Time', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Thread_Blocked_Time', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Thread_Blocked_Time', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Thread_Blocked_Time', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Thread_Blocked_Event', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Thread_Blocked_Event', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Thread_Blocked_Event', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Thread_Blocked_Event', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='ShardEvents', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='ShardEvents', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='ShardEvents', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='ShardEvents', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='ShardBulkDocs', agg='min', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='ShardBulkDocs', agg='max', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='ShardBulkDocs', agg='avg', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='ShardBulkDocs', agg='sum', dimensions=['ShardID', 'IndexName', 'Operation', 'ShardRole']),
        MetricDescription(name='Latency', agg='min', dimensions=['Operation', 'Exception', 'Indices', 'HTTPRespCode', 'ShardID', 'IndexName', 'ShardRole']),
        MetricDescription(name='Latency', agg='max', dimensions=['Operation', 'Exception', 'Indices', 'HTTPRespCode', 'ShardID', 'IndexName', 'ShardRole']),
        MetricDescription(name='Latency', agg='avg', dimensions=['Operation', 'Exception', 'Indices', 'HTTPRespCode', 'ShardID', 'IndexName', 'ShardRole']),
        MetricDescription(name='Latency', agg='sum', dimensions=['Operation', 'Exception', 'Indices', 'HTTPRespCode', 'ShardID', 'IndexName', 'ShardRole']),
        MetricDescription(name='GC_Collection_Event', agg='min', dimensions=['MemType']),
        MetricDescription(name='GC_Collection_Event', agg='max', dimensions=['MemType']),
        MetricDescription(name='GC_Collection_Event', agg='avg', dimensions=['MemType']),
        MetricDescription(name='GC_Collection_Event', agg='sum', dimensions=['MemType']),
        MetricDescription(name='GC_Collection_Time', agg='min', dimensions=['MemType']),
        MetricDescription(name='GC_Collection_Time', agg='max', dimensions=['MemType']),
        MetricDescription(name='GC_Collection_Time', agg='avg', dimensions=['MemType']),
        MetricDescription(name='GC_Collection_Time', agg='sum', dimensions=['MemType']),
        MetricDescription(name='Heap_Committed', agg='min', dimensions=['MemType']),
        MetricDescription(name='Heap_Committed', agg='max', dimensions=['MemType']),
        MetricDescription(name='Heap_Committed', agg='avg', dimensions=['MemType']),
        MetricDescription(name='Heap_Committed', agg='sum', dimensions=['MemType']),
        MetricDescription(name='Heap_Init', agg='min', dimensions=['MemType']),
        MetricDescription(name='Heap_Init', agg='max', dimensions=['MemType']),
        MetricDescription(name='Heap_Init', agg='avg', dimensions=['MemType']),
        MetricDescription(name='Heap_Init', agg='sum', dimensions=['MemType']),
        MetricDescription(name='Heap_Max', agg='min', dimensions=['MemType']),
        MetricDescription(name='Heap_Max', agg='max', dimensions=['MemType']),
        MetricDescription(name='Heap_Max', agg='avg', dimensions=['MemType']),
        MetricDescription(name='Heap_Max', agg='sum', dimensions=['MemType']),
        MetricDescription(name='Heap_Used', agg='min', dimensions=['MemType']),
        MetricDescription(name='Heap_Used', agg='max', dimensions=['MemType']),
        MetricDescription(name='Heap_Used', agg='avg', dimensions=['MemType']),
        MetricDescription(name='Heap_Used', agg='sum', dimensions=['MemType']),
        MetricDescription(name='Disk_Utilization', agg='min', dimensions=['DiskName']),
        MetricDescription(name='Disk_Utilization', agg='max', dimensions=['DiskName']),
        MetricDescription(name='Disk_Utilization', agg='avg', dimensions=['DiskName']),
        MetricDescription(name='Disk_Utilization', agg='sum', dimensions=['DiskName']),
        MetricDescription(name='Disk_WaitTime', agg='min', dimensions=['DiskName']),
        MetricDescription(name='Disk_WaitTime', agg='max', dimensions=['DiskName']),
        MetricDescription(name='Disk_WaitTime', agg='avg', dimensions=['DiskName']),
        MetricDescription(name='Disk_WaitTime', agg='sum', dimensions=['DiskName']),
        MetricDescription(name='Disk_ServiceRate', agg='min', dimensions=['DiskName']),
        MetricDescription(name='Disk_ServiceRate', agg='max', dimensions=['DiskName']),
        MetricDescription(name='Disk_ServiceRate', agg='avg', dimensions=['DiskName']),
        MetricDescription(name='Disk_ServiceRate', agg='sum', dimensions=['DiskName']),
        MetricDescription(name='Net_TCP_NumFlows', agg='min', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_NumFlows', agg='max', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_NumFlows', agg='avg', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_NumFlows', agg='sum', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_TxQ', agg='min', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_TxQ', agg='max', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_TxQ', agg='avg', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_TxQ', agg='sum', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_RxQ', agg='min', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_RxQ', agg='max', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_RxQ', agg='avg', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_RxQ', agg='sum', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_Lost', agg='min', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_Lost', agg='max', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_Lost', agg='avg', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_Lost', agg='sum', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_SendCWND', agg='min', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_SendCWND', agg='max', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_SendCWND', agg='avg', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_SendCWND', agg='sum', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_SSThresh', agg='min', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_SSThresh', agg='max', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_SSThresh', agg='avg', dimensions=['DestAddr']),
        MetricDescription(name='Net_TCP_SSThresh', agg='sum', dimensions=['DestAddr']),
        MetricDescription(name='Net_PacketRate4', agg='min', dimensions=['Direction']),
        MetricDescription(name='Net_PacketRate4', agg='max', dimensions=['Direction']),
        MetricDescription(name='Net_PacketRate4', agg='avg', dimensions=['Direction']),
        MetricDescription(name='Net_PacketRate4', agg='sum', dimensions=['Direction']),
        MetricDescription(name='Net_PacketDropRate4', agg='min', dimensions=['Direction']),
        MetricDescription(name='Net_PacketDropRate4', agg='max', dimensions=['Direction']),
        MetricDescription(name='Net_PacketDropRate4', agg='avg', dimensions=['Direction']),
        MetricDescription(name='Net_PacketDropRate4', agg='sum', dimensions=['Direction']),
        MetricDescription(name='Net_PacketRate6', agg='min', dimensions=['Direction']),
        MetricDescription(name='Net_PacketRate6', agg='max', dimensions=['Direction']),
        MetricDescription(name='Net_PacketRate6', agg='avg', dimensions=['Direction']),
        MetricDescription(name='Net_PacketRate6', agg='sum', dimensions=['Direction']),
        MetricDescription(name='Net_PacketDropRate6', agg='min', dimensions=['Direction']),
        MetricDescription(name='Net_PacketDropRate6', agg='max', dimensions=['Direction']),
        MetricDescription(name='Net_PacketDropRate6', agg='avg', dimensions=['Direction']),
        MetricDescription(name='Net_PacketDropRate6', agg='sum', dimensions=['Direction']),
        MetricDescription(name='Net_Throughput', agg='min', dimensions=['Direction']),
        MetricDescription(name='Net_Throughput', agg='max', dimensions=['Direction']),
        MetricDescription(name='Net_Throughput', agg='avg', dimensions=['Direction']),
        MetricDescription(name='Net_Throughput', agg='sum', dimensions=['Direction']),
        MetricDescription(name='ThreadPool_QueueSize', agg='min', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_QueueSize', agg='max', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_QueueSize', agg='avg', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_QueueSize', agg='sum', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_RejectedReqs', agg='min', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_RejectedReqs', agg='max', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_RejectedReqs', agg='avg', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_RejectedReqs', agg='sum', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_TotalThreads', agg='min', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_TotalThreads', agg='max', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_TotalThreads', agg='avg', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_TotalThreads', agg='sum', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_ActiveThreads', agg='min', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_ActiveThreads', agg='max', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_ActiveThreads', agg='avg', dimensions=['ThreadPoolType']),
        MetricDescription(name='ThreadPool_ActiveThreads', agg='sum', dimensions=['ThreadPoolType']),
        MetricDescription(name='HTTP_RequestDocs', agg='min', dimensions=['Operation', 'Exception', 'Indices', 'HTTPRespCode']),
        MetricDescription(name='HTTP_RequestDocs', agg='max', dimensions=['Operation', 'Exception', 'Indices', 'HTTPRespCode']),
        MetricDescription(name='HTTP_RequestDocs', agg='avg', dimensions=['Operation', 'Exception', 'Indices', 'HTTPRespCode']),
        MetricDescription(name='HTTP_RequestDocs', agg='sum', dimensions=['Operation', 'Exception', 'Indices', 'HTTPRespCode']),
        MetricDescription(name='HTTP_TotalRequests', agg='min', dimensions=['Operation', 'Exception', 'Indices', 'HTTPRespCode']),
        MetricDescription(name='HTTP_TotalRequests', agg='max', dimensions=['Operation', 'Exception', 'Indices', 'HTTPRespCode']),
        MetricDescription(name='HTTP_TotalRequests', agg='avg', dimensions=['Operation', 'Exception', 'Indices', 'HTTPRespCode']),
        MetricDescription(name='HTTP_TotalRequests', agg='sum', dimensions=['Operation', 'Exception', 'Indices', 'HTTPRespCode']),
        MetricDescription(name='CB_EstimatedSize', agg='min', dimensions=['CBType']),
        MetricDescription(name='CB_EstimatedSize', agg='max', dimensions=['CBType']),
        MetricDescription(name='CB_EstimatedSize', agg='avg', dimensions=['CBType']),
        MetricDescription(name='CB_EstimatedSize', agg='sum', dimensions=['CBType']),
        MetricDescription(name='CB_TrippedEvents', agg='min', dimensions=['CBType']),
        MetricDescription(name='CB_TrippedEvents', agg='max', dimensions=['CBType']),
        MetricDescription(name='CB_TrippedEvents', agg='avg', dimensions=['CBType']),
        MetricDescription(name='CB_TrippedEvents', agg='sum', dimensions=['CBType']),
        MetricDescription(name='CB_ConfiguredSize', agg='min', dimensions=['CBType']),
        MetricDescription(name='CB_ConfiguredSize', agg='max', dimensions=['CBType']),
        MetricDescription(name='CB_ConfiguredSize', agg='avg', dimensions=['CBType']),
        MetricDescription(name='CB_ConfiguredSize', agg='sum', dimensions=['CBType']),
    ]
